package my.lotu.action;


import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

import my.lotu.bean.Food;
import my.lotu.service.FoodService;

@SuppressWarnings("serial")
public class GetFoodAction extends ActionSupport {
	private FoodService foodService;
	private List<Food> foodList;
	
	public String drink(){
		foodList=foodService.findDrink(3);
		if(foodList==null){
			return ERROR;
		}
		
		return SUCCESS;
	}
	public String snake(){
		foodList=foodService.findSnack(3);
		if(foodList==null){
			return ERROR;
		}
		
		return SUCCESS;
	}
	public String pasta(){
		foodList=foodService.findPastaFood(3);
		if(foodList==null){
			return ERROR;
		}
		
		return SUCCESS;
	}
	public String staple(){
		foodList=foodService.findStapleFood(3);
		if(foodList==null){
			return ERROR;
		}
		return SUCCESS;
	}
	
	
	
	public FoodService getFoodService() {
		return foodService;
	}

	public void setFoodService(FoodService foodService) {
		this.foodService = foodService;
	}
	public List<Food> getFoodList() {
		List<Food> list=foodList.subList(0, foodList.size());
		return list;
	}
	public void setFoodList(List<Food> foodList) {
		this.foodList = foodList;
	}
	
}
